﻿using UnityEngine;

public class MapDisplay : MonoBehaviour {
    #region 变量
    public Renderer textureRender;
    public MeshFilter meshFilter;
    public MeshRenderer meshRender;

    #endregion

    #region 自定义函数
    /// <summary>
    ///  显示噪声图
    /// </summary>
    /// <param name="noiseMap">噪声图</param>
    public void DrawTexture (Texture2D texture) {

        // 编辑窗口下实时渲染
        textureRender.sharedMaterial.mainTexture = texture;
        // 设置大小
        textureRender.transform.localScale = new Vector3 (texture.width, 1, texture.height);
    }

    public void DrawMesh (MeshData meshData, Texture2D texture) {
        meshFilter.sharedMesh = meshData.CreatMesh ();
        meshRender.sharedMaterial.mainTexture = texture;
    }
    #endregion
}